var Sequra;(()=>{var e={843:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateNumber=t.resetPromotionalWidget=t.removeElement=t.parseValue=t.parseNumber=t.isIframeNameValid=t.iframeTitles=t.getIframeTitle=t.getDeploymentTarget=t.generateUID=t.createProps=t.createIframe=t.buildIframeURL=t.applyStyles=void 0;var a=o(132);const r=e=>{if(!e)return{value:"0",valid:!1,errors:[],warnings:["No number passed. Amount for sample case will be used"]};const t=e.match(/\d+[.,]?/g);t.length>1&&(t[t.length-1]=`${t[t.length-1]}00`.slice(0,2));const o=t.join("").replace(/\D/g,"");return e!==o&&o?{value:o,valid:!0,errors:[],warnings:[`Invalid amount ${e}, expected cents. Using ${o} as amount`]}:{value:e,valid:!0,errors:[],warnings:[]}};t.validateNumber=r,t.parseNumber=e=>{const{valid:t,value:o,warnings:a,errors:n}=r(e);if((e=>{e.forEach((e=>console.error(`[SeQura] ${e}`)))})(n),(e=>{e.forEach((e=>console.warn(`[SeQura] ${e}`)))})(a),t)return o};const n={"educational-popup":"4299762f54b853b6d4b4","promotion-widget":"8c74f40ac0c370b0d978"},i=e=>Object.keys(n).includes(e);t.isIframeNameValid=i;const s=e=>{let{iframeName:t,params:o={}}=e;if(!i(t))return null;const a=new URL(`https://live.sequracdn.com/assets/static/${t}.${n[t]}.html`);for(const e in o)if(o.hasOwnProperty(e)){const t="object"==typeof o[e]?encodeURIComponent(JSON.stringify(o[e])):encodeURIComponent(o[e]);a.searchParams.append(e,t)}return a.href};t.buildIframeURL=s,t.removeElement=e=>{let{selector:t}=e;(0,a.querySelectorAll)(document,t).forEach((e=>{e.remove()}))};const l={border:0,width:"100%",height:"100%"},u={"educational-popup":{height:"100%",width:"100%",position:"fixed",top:"0",left:"0",right:"0",bottom:"0",zIndex:"99999999",transition:"opacity .2s ease-in-out"},"promotion-widget":{width:"100%",position:"relative",display:"inline-block"}},c=e=>{let{element:t,styles:o}=e;for(const e in o)t.style[e]=o[e]};t.applyStyles=c;const d={logLevel:"error",version:"latest"},m=e=>{let t="";for(let o=0;o{let t,o,{product:a,locale:r}=e;switch(a){case"pp5":t="pp5";break;case"i1":t="i1";break;default:t="pp3"}switch(r){case"pt-PT":o="pt";break;case"fr-FR":o="fr";break;case"it-IT":o="it";break;default:o="es"}return p[t][o]};t.getIframeTitle=f,t.createIframe=e=>{let{params:t,selector:o,classname:a,iframeName:r}=e;if(!i(r))return null;const n=m(10),p=document.createElement("div");p.className=a+"Wrapper",p.id=a+`Wrapper-${n}`,c({element:p,styles:u[r]});const g=document.createElement("iframe");g.src=s({iframeName:r,params:{...t,...d,uid:n}}),g.id=n,g.className=a,g.loading="eager",g.title=f({product:t.product,locale:t.locale}),c({element:g,styles:l}),p.appendChild(g);let h=o;"object"!=typeof o&&(h=document.querySelector(o)||window.document.body),h.appendChild(p)},t.createProps=e=>{let{product:t,campaign:o,totalWithTax:r,theme:n,reverse:i,registrationAmount:s,openContext:l,config:u}=e;const c=(0,a.getProductConfigFromProductsConfig)({productConfig:u.productsConfig,product:t,campaign:o});if(!c.valid)throw new Error("Invalid product config");let d=s;void 0!==s&&(d=parseInt(s));return{env:u.env,formatterConfig:u.formatterConfig,merchant:u.merchant,product:t,productConfig:{...c.value,registration_total:d},totalWithTax:r,theme:n,reverse:i,silent:u.silent,disclaimers:c?.value?.disclaimers,openContext:l}},t.parseValue=e=>{try{return JSON.parse(e)}catch(e){return}},t.resetPromotionalWidget=e=>{let t=document.getElementById(e);for(;t;){if(t.classList.contains("sequra-promotion-widget")){t.removeAttribute("data-loaded");break}t=t.parentNode}document.getElementById(e).remove(),document.getElementById("Sequra__PromotionalWidgetWrapper-"+e).remove()},t.getDeploymentTarget=e=>e?.includes("svea")?"svea":"sequra"},178:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateConfiguration=t.renderEducationalPopup=t.refreshComponents=t.onLoad=t.default=t.computeCreditAgreements=void 0;var a=o(106),r=o(225),n=o(843),i=o(132);const s={},l=t.renderEducationalPopup=function(e,t,o){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"body",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";const i={env:s.env,merchant:s.merchant,product:e,totalWithTax:o};""!==r&&(i.openContext=r),t&&(i.campaign=t),(0,n.createIframe)({params:i,selector:a,classname:"Sequra__EducationalPopup",iframeName:"educational-popup"})},u=function(){try{(0,i.querySelectorAll)(document,".sequra-educational-popup").forEach((e=>{const{loaded:t}=e.dataset;t||(e.setAttribute("data-loaded",1),e.addEventListener("click",(t=>{t.stopPropagation();const{product:o,campaign:a,amount:r}=e.dataset,i=(0,n.parseNumber)(r);l(o,a,i)})))}))}catch(e){throw e}},c=function(){try{(0,i.querySelectorAll)(document,".sequra-promotion-widget").forEach((e=>{const{product:t,campaign:o,amount:a,theme:r,reverse:l,loaded:u,registrationAmount:c,...d}=e.dataset;let m;if(Object.keys(d).length>0){const e=["type","size","fontColor","backgroundColor","alignment","branding","startingText","amountFontSize","amountFontColor","amountFontBold","linkFontColor","linkUnderline","borderColor","borderRadius","noCostsClaim","version"],t=new i.ThemeBuilder;e.forEach((e=>{t[e]=d[e]})),m=t.theme}else m=(0,i.themeFactory)({theme:r});const p={env:s.env,merchant:s.merchant,product:t,totalWithTax:(0,n.parseNumber)(a),campaign:o,theme:m,reverse:l,locale:s.formatterConfig.locale,registrationAmount:void 0!==c?parseInt(c):null};if(!u){if("pp5"===t&&!o)return;(0,n.createIframe)({params:p,selector:e,classname:"Sequra__PromotionalWidget",iframeName:"promotion-widget"}),e.setAttribute("data-loaded",1)}if(u)try{const r=(0,n.createProps)({product:t,campaign:o,totalWithTax:(0,n.parseNumber)(a),theme:m,reverse:l,registrationAmount:c,config:s});e.querySelector(".Sequra__PromotionalWidget").contentWindow.postMessage({action:"Sequra.refreshWidget",data:r},"*")}catch(e){console.warn(`[SeQura] Promotional widget for product ${t} ${o?`with campaign ${o}`:""} not updated.`)}}))}catch(e){throw e}},d=()=>{c(),u()};t.refreshComponents=d;const m=t.onLoad=function e(t){try{"function"==typeof t?s.isReady?t():setTimeout((()=>{e(t)}),500):console.warn("[SeQura] Expected onLoad parameter to be a function")}catch(e){throw e}};t.default=async e=>{try{s.env="production",s.merchant=e?.merchant,s.assetKey=e?.assetKey,s.scriptUri=e?.scriptUri,s.deploymentTarget=(0,n.getDeploymentTarget)(e?.scriptUri),s.products=e?.products,s.silent=e?.silent,s.formatterConfig={decimalSeparator:e?.decimalSeparator,thousandSeparator:e?.thousandSeparator,locale:e?.locale,currency:e?.currency};const{merchant:t,assetKey:o,products:a,deploymentTarget:r}=s;s.productsConfig={};const d=await(0,i.fetchProductsConfig)({merchant:t,assetKey:o,products:a,deploymentTarget:r});s.productsConfig=d,s.productsConfig?(s.isReady=!0,window.addEventListener("message",(e=>{try{const t=(0,n.parseValue)(e?.data);switch(t.action){case"Sequra.closingPopup":(0,n.removeElement)({selector:".Sequra__EducationalPopupWrapper"});break;case"Sequra.openPopup":const{totalWithTax:e,productConfig:a}=t.params;l(a.product,a.campaign,e,void 0,void 0);break;case"Sequra.defineWidgetHeight":const{uid:r,height:u}=t.params;document.getElementById(r).style.height=u+"px",document.getElementById("Sequra__PromotionalWidgetWrapper-"+r).style.height=u+"px";break;case"Sequra.getProductConfig":const{uid:c,product:d,campaign:m}=t.data;try{const e=(0,i.getProductConfigFromProductsConfig)({productConfig:s.productsConfig,product:d,campaign:m});if(e.valid){const a={env:s.env,formatterConfig:s.formatterConfig,merchant:s.merchant,assetKey:o,product:d,campaign:m,productConfig:{...e.value,registration_total:t.data.registrationAmount||null},silent:s.silent,disclaimers:e.value.disclaimers||[],deploymentTarget:s.deploymentTarget};document.getElementById(c).contentWindow.postMessage({data:{...a,uid:c},action:"Sequra.postProductConfig"},"https://live.sequracdn.com/assets")}else(0,n.resetPromotionalWidget)(c)}catch(e){console.warn(`[SeQura] Educational popup for product ${d} ${m?`with campaign ${m}`:""} not rendered.`)}}}catch(e){}})),window.SequraOnLoad.forEach((e=>{m(e)})),c(),u()):console.warn(`[SeQura] Could not fetch product information with merchant ${t} and assetKey ${o}, review your credentials.`)}catch(e){throw e}},t.updateConfiguration=async e=>{try{const{merchant:t,assetKey:o,scriptUri:a,products:r,decimalSeparator:l,thousandSeparator:u,locale:c,currency:m,rebranding:p,silent:f}=e;if(!(t&&o&&r&&a))return void console.warn('[SeQura] "merchant", "assetKey", "products" and "scriptUri" are required.');const g=(0,n.getDeploymentTarget)(a),h=await(0,i.fetchProductsConfig)({merchant:t,assetKey:o,products:r,deploymentTarget:g});if(!h)throw console.warn(`[SeQura] Could not fetch product information with merchant ${t} and assetKey ${o}, review your credentials.`),new Error("updateConfigurationError");s.productsConfig=h,s.merchant=t,s.assetKey=o,s.scriptUri=a,s.deploymentTarget=g,s.products=r,s.silent=f,s.formatterConfig={decimalSeparator:l||s.formatterConfig?.decimalSeparator,thousandSeparator:u||s.formatterConfig?.thousandSeparator,locale:c||s.formatterConfig?.locale,currency:m||s.formatterConfig?.currency},p&&(s.rebranding=p),d()}catch(e){throw e}},t.computeCreditAgreements=e=>{const{product:t,amount:o,campaign:n,instalmentCount:i,registrationTotal:l}=e||{};if((0,a.isEmpty)(o))return console.warn("[SeQura] Mandatory 'amount' for computeCreditAgreements"),{};let u={};return Object.values(s.productsConfig).forEach((e=>{(e instanceof Array?e:[e]).forEach((e=>{const t=(0,r.computeCreditAgreement)({totalWithTax:parseInt(o,10),formatterConfig:s.formatterConfig,productConfig:{...e,registration_total:l?parseInt(l,10):void 0}})[e.product];(0,a.isEmpty)(t)||(u[e.product]=u[e.product]||[],t.forEach((t=>u[e.product].push(t))))}))})),(0,a.isEmpty)(t)||(u=Object.keys(u).filter((e=>e===t)).reduce(((e,t)=>({...e,[t]:u[t]})),{})),(0,a.isEmpty)(n)||(u=Object.keys(u).reduce(((e,t)=>({...e,[t]:u[t].filter((e=>e.campaign===n))})),{})),(0,a.isEmpty)(i)||(u=Object.keys(u).reduce(((e,t)=>({...e,[t]:u[t].filter((e=>e.instalment_count===i))})),{})),u=Object.keys(u).reduce(((e,t)=>(0,a.isEmpty)(u[t])?e:{...e,[t]:u[t]}),{}),u}},1:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=o(931))&&a.__esModule?a:{default:a};t.default=class{constructor(){this.object=(0,r.default)()}set class(e){this.object.class=e||this.object.class}set type(e){this.object.type=e||this.object.type}set size(e){this.object.size=e||this.object.size}set fontColor(e){this.object.fontColor=e||this.object.fontColor}set backgroundColor(e){this.object.backgroundColor=e||this.object.backgroundColor}set alignment(e){this.object.alignment=e||this.object.alignment}set branding(e){this.object.branding=e||this.object.branding}set startingText(e){this.object.startingText=e||this.object.startingText}set amountFontSize(e){this.object.amountFontSize=e||this.object.amountFontSize}set amountFontColor(e){this.object.amountFontColor=e||this.object.amountFontColor}set amountFontBold(e){this.object.amountFontBold=e||this.object.amountFontBold}set linkFontColor(e){this.object.linkFontColor=e||this.object.linkFontColor}set linkUnderline(e){this.object.linkUnderline=e||this.object.linkUnderline}set borderColor(e){this.object.borderColor=e||this.object.borderColor}set borderRadius(e){this.object.borderRadius=e||this.object.borderRadius}set noCostsClaim(e){this.object.noCostsClaim=e||this.object.noCostsClaim}set version(e){this.object.version=e||this.object.version}get theme(){return this.object}}},934:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r.default}});var a,r=(a=o(1))&&a.__esModule?a:{default:a}},914:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=async e=>{let t,{merchant:o,assetKey:a,products:r,deploymentTarget:n}=e;r.includes("i1")&&(t={i1:{product:"i1",purchase_credit_days:7}},r.splice(r.indexOf("i1"),1));let i="https://live.sequracdn.com";if("svea"===n&&(i="https://live.cdn.sequra.svea.com"),r.length>0)try{const e=await fetch(`${i}/scripts/${o}/${a}/${r.join("_")}_cost.json`);if(!e.ok)throw new Error("Request failed");const n=await e.json();t={...t,...n}}catch(e){console.log(e)}return t}},889:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=e=>{let{productConfig:t,product:o,campaign:a}=e;const r="pp5"===o?(t[o]||[]).find((e=>e.campaign===a)):t[o],n={valid:!0,value:null,warnings:[],errors:[]};return r?(n.value=r,n):(n.valid=!1,n.errors=[`Product ${o} ${a?`with campaign ${a}`:""} not found or expired.`],n)}},132:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ThemeBuilder",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"fetchProductsConfig",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"getProductConfigFromProductsConfig",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"querySelectorAll",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"themeBaseFactory",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"themeFactory",{enumerable:!0,get:function(){return n.default}});var a=u(o(931)),r=u(o(934)),n=u(o(136)),i=u(o(889)),s=u(o(914)),l=u(o(193));function u(e){return e&&e.__esModule?e:{default:e}}},106:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEqual=t.isEmpty=void 0,t.isEmpty=e=>null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length,t.isEqual=(e,t)=>JSON.stringify(e)===JSON.stringify(t)},193:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(e,t)=>[...e.querySelectorAll(t)]},931:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;const o={class:"",type:"text",size:"M",fontColor:"",backgroundColor:"",alignment:"center",branding:"default",startingText:"only",amountFontSize:"",amountFontColor:"",amountFontBold:"",linkFontColor:"",linkUnderline:"",borderColor:"",borderRadius:"",noCostsClaim:"",version:""};t.default=()=>Object.assign({},o)},136:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r.default}});var a,r=(a=o(253))&&a.__esModule?a:{default:a}},253:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=n(o(931)),r=n(o(934));function n(e){return e&&e.__esModule?e:{default:e}}t.default=function(){let{theme:e="default"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,a.default)(),o={default:{...t,type:"banner"},white:{...t,type:"banner",backgroundColor:"white"},legacy:{...t,type:"legacy"},"legacy-negative":{...t,type:"legacy",fontColor:"white",branding:"white"}},n=o[e]||o.default,i=new r.default;return i.type=n.type,i.size=n.size,i.fontColor=n.fontColor,i.backgroundColor=n.backgroundColor,i.alignment=n.alignment,i.branding=n.branding,i.startingText=n.startingText,i.amountFontSize=n.amountFontSize,i.amountFontColor=n.amountFontColor,i.amountFontBold=n.amountFontBold,i.linkFontColor=n.linkFontColor,i.linkUnderline=n.linkUnderline,i.borderColor=n.borderColor,i.borderRadius=n.borderRadius,i.noCostsClaim=n.noCostsClaim,i.version=n.version,i.theme}},225:function(e,t){!function(e){"use strict";const t="es-ES",o="EUR",a=function(e){let{decimalSeparator:a,thousandSeparator:r,currency:n=o,locale:i=t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=Number((e/100).toFixed(2));return new Intl.NumberFormat(i,{style:"currency",currency:n}).formatToParts(s).map((e=>{let{type:t,value:o}=e;switch(t){case"group":return r||o;case"decimal":return a||o;default:return o}})).join("")},r=function(e){let{percentageSymbol:o,decimalSeparator:a,thousandSeparator:r,locale:n=t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=parseFloat(e).toFixed(2)/100;return new Intl.NumberFormat(n,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(i).map((e=>{let{type:t,value:n}=e;switch(t){case"group":return r||n;case"decimal":return a||n;case"unit":return o||n;default:return n}})).join("")},n=e=>parseInt(e.toFixed(2).replace(".",""),10),i=function(e){let{locale:o=t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Date(e).toLocaleDateString(o,{day:"numeric",month:"long"})};var s=(e,t)=>{const o=t.find((t=>{let[o]=t;return o>e}));return o?o[1]:t.slice().pop()[1]};const l=(e,t,o)=>{if(e.max-e.min>1e-5){const a=(e.min+e.max)/2,r=((e,t)=>Object.keys(e).map((o=>e[o]*(1+t)**(-o/365))).reduce(((e,t)=>e+t),0))(o,a),n=e;return r-t>0?n.min=a:n.max=a,l(n,t,o)}return(e.min+e.max)/2};var u=(e,t,o)=>{const a=Object.values(t).reduce(((e,t)=>e+t),0);if(e>a)throw Error(`Initial debt (${e}) cannot be higher than total payments (${a})`);if(e<0)throw Error(`Initial debt (${e}) cannot be lower than 0`);const r=Object.keys(t).reduce(((e,a)=>{const r=new Date(a),n=new Date(o);return e[Math.ceil(function(e,t){const o=Math.abs(t.getTime()-e.getTime());return Math.round(o/864e5)}(r,n))]=t[a],e}),{}),n=((e,t,o)=>{let a=(o/e)**(1/(Object.keys(t)[0]/365))-1;return a>1e4&&(a=1e4),{min:0,max:a}})(e,r,a);return 100*l(n,e,r)};function c(e,t){if(!(e instanceof Date)||Number.isNaN(e))throw new Error("Invalid date object");if("number"!=typeof t||!Number.isInteger(t))throw new Error("Months must be a valid integer");const o=new Date(e);return o.setMonth(o.getMonth()+t),o.toISOString()}var d=e=>{const t=[...e].sort(((e,t)=>t.instalment_count-e.instalment_count)),o=t.findIndex((e=>e.instalment_total.value/e.instalment_amount.value<=1.2));return t[o>=0?o:t.length-1].default=!0,t.sort(((e,t)=>e.instalment_count-t.instalment_count))};const m=e=>{let{feesTable:t,totalWithTax:o}=e;const a=Object.keys(t);return t[a.find((e=>o{let{feesTable:t,instalmentCount:o}=e;return t[o.toString()]},f=e=>{let{feesTable:t,instalmentCounts:o}=e;const a=JSON.parse(JSON.stringify(t)),r=Object.keys(a),n=r.filter((e=>Object.keys(a[e]).toString()!==o.toString()));if(0===n.length)return t;const i=[];r.forEach((e=>{i.push({financialAmount:e,data:a[e]})}));const s=e=>{let{financialAmount:t,instalment:o,next:a,nextIndex:r}=e,n=void 0!==r?r:0;const l=a||i.find(((e,o)=>(n=o,e.financialAmount===t)));return void 0===l.data[o]?s({instalment:o,next:i[n+1],nextIndex:n+1}):l.data[o]};return n.forEach((e=>{o.forEach((t=>{a[e][t]=s({financialAmount:e,instalment:t})}))})),a};var g=(e,t,o)=>{let{instalment_counts:l,product:g,fees_table:h,fees_table_2d:b,fees_table_3d:v,max_amount:y,min_amount:_,min_amounts:C,first_date:w,last_date:j,registration_total:S=0,setup_fee_percentages:T,setup_fee_min_amounts:x,instalment_fee_percentages:P}=t;const O=new Date,k=Math.min(e,y),I=Math.max(0,e-y),E=k-S,M=S>0?0:1,F=(e=>{let{feesTable2d:t,feesTable3d:o}=e;return o&&Object.keys(o).length>0?"3d":t&&Object.keys(t).length>0?"2d":"1d"})({feesTable2d:b,feesTable3d:v}),q=(e=>{let{feesTable1d:t,feesTable2d:o,feesTable3d:a,feesTableType:r}=e;switch(r){case"1d":return t;case"2d":return o;default:return a}})({feesTable1d:h,feesTable2d:b,feesTable3d:v,feesTableType:F}),N=Array.isArray(l)?l:[l],W="3d"===F?m({feesTable:f({feesTable:q,instalmentCounts:N}),totalWithTax:e}):q,A=T&&"3d"===F?m({feesTable:f({feesTable:T,instalmentCounts:N}),totalWithTax:e}):T,$=N.map((t=>{const l="1d"===F?W:p({feesTable:W,instalmentCount:t}),d=P?p({feesTable:P,instalmentCount:t}):0,m=Math.ceil(d*(k/1e4)),f=Math.trunc(E/t),h=s(E,l)+m,b=f+h,v=A?p({feesTable:A,instalmentCount:t}):0,T=x?p({feesTable:x,instalmentCount:t}):0,q=Math.ceil(e*(v/1e4)),N=Math.max(q,T),$=(e=>{let{registrationTotal:t,upToMax:o,overMax:a,instalmentCount:r}=e;return t>0?t+a:((e,t,o)=>Math.trunc(t+o/100*e))(o,a,100/r)})({registrationTotal:S,upToMax:k,overMax:I,instalmentCount:t}),U=S>0?0:h,z=$+U+N,D=e-$,Q=t-M,R=h*Q+U+N,B=Math.round(1e4*R/e),L=e+R,K=((e,t,o)=>void 0===t?e:t.find((e=>{let{instalment_count_threshold:t}=e;return o<=t})).min_amount)(_,C,t),J=e>=K,V={cost_of_credit_pct:{value:B,string:r(B/100,o)},cost_of_credit:{value:R,string:a(R,o)},default:!1,down_payment_amount:{value:$,string:a($,o)},down_payment_fees:{value:U,string:a(U,o)},down_payment_total:{value:z,string:a(z,o)},drawdown_payment_amount:{value:D,string:a(D,o)},grand_total:{value:L,string:a(L,o)},instalment_amount:{value:f,string:a(f,o)},instalment_count:t,instalment_fee:{value:h,string:a(h,o)},instalment_total:{value:b,string:a(b,o)},interest:{value:0,string:r(0,o)},max_amount:{value:y,string:a(y,o)},max_credit:{value:y,string:a(y,o)},max_financed_amount:{value:y,string:a(y,o)},min_amount:{value:K,string:a(K,o)},min_credit:{value:K,string:a(K,o)},over_max_financed_amount:{value:I,string:a(I,o)},over_max:{value:I,string:a(I,o)},remaining_instalment_count:Q,setup_fee:{value:N,string:a(N,o)},setup_fee_min_amount:{value:T,string:a(T,o)},setup_fee_percentage:{value:v,string:r(v/100,o)},total_with_tax:{value:e,string:a(e,o)},available:J,product:g},H=((e,t,o,a,r)=>{const n={};for(let a=0;a0){const e=Object.keys(n);n[e[e.length-1]]+=i}return n})(O,Q,b,D,f);let G;try{G=u(e-$-h-N,H,O.toISOString())}catch(e){G=9e3}return V.apr={value:n(G),string:r(G,o)},w&&(V.first_date={value:w,string:i(w,o)}),j&&(V.last_date={value:j,string:i(j,o)}),V}));return{[g]:d($)}};e.computeCreditAgreement=e=>{let{totalWithTax:t,productConfig:o,formatterConfig:l}=e;return((e,t,o)=>{switch(t.product){case"pp3":case"pp6":case"pp9":case"sp1":return g(e,t,o);case"pp5":return((e,t,o)=>{let{product:l,campaign:c,fees_table:d,max_amount:m,min_amount:p,first_date:f,last_date:g,due_date:h,due_in:b,title:v}=t;const y=new Date,_=Math.min(e,m),C=s(_,d),w=C,j=Math.max(0,e-m),S=j,T=e-S,x=S+w,P=C+0,O=Math.round(1e4*P/e),k=e+P,I={agreed_amount:{value:T,string:a(T,o)},campaign:c,cost_of_credit_pct:{value:O,string:r(O/100,o)},cost_of_credit:{value:P,string:a(P,o)},down_payment_amount:{value:S,string:a(S,o)},down_payment_fees:{value:w,string:a(w,o)},down_payment_total:{value:x,string:a(x,o)},drawdown_payment_amount:{value:T,string:a(T,o)},due_date:{value:h,string:i(h,o)},end_date:{value:g,string:i(g,o)},first_date:{value:f,string:i(f,o)},grand_total:{value:k,string:a(k,o)},instalment_count:1,instalment_fee:{value:0,string:a(0,o)},interest:{value:0,string:r(0,o)},last_date:{value:g,string:i(g,o)},max_credit:{value:m,string:a(m,o)},max_financed_amount:{value:m,string:a(m,o)},min_amount:{value:p,string:a(p,o)},min_credit:{value:p,string:a(p,o)},over_max_financed_amount:{value:j,string:a(j,o)},product:l,setup_fee:{value:C,string:a(C,o)},start_date:{value:f,string:i(f,o)},total_with_tax:{value:e,string:a(e,o)}},E={[h]:T};let M;try{M=u(T-C,E,y.toISOString())}catch(e){M=9e3}var F;return I.apr={value:n(M),string:r(M,o)},b&&(I.due_in={value:b,string:(F=b,`${F} días`)}),v&&(I.title=v),{pp5:[I]}})(e,t,o);case"r1":return((e,t)=>{let{product:o}=t;return{[o]:[{totalWithTax:e}]}})(e,t);default:return[]}})(t,o,l)},e.computeMaxDiscount=(e,t)=>function(e){let t=0;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).reduce(((o,a)=>a.min_amount<=e&&a.min_amount>=t?(t=a.min_amount,a.discount):o),0)}(e,t)}(t)}},t={};function o(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a].call(n.exports,n,n.exports,o),n.exports}var a={};(()=>{"use strict";var e=a;e.default=void 0;var t=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var o=r(t);if(o&&o.has(e))return o.get(e);var a={__proto__:null},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=n?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,o&&o.set(e,a),a}(o(178));function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(r=function(e){return e?o:t})(e)}window.SequraConfiguration&&async function(){await(0,t.default)(window.SequraConfiguration)}(),e.default={onLoad:t.onLoad,updateConfiguration:t.updateConfiguration,refreshComponents:t.refreshComponents,computeCreditAgreements:t.computeCreditAgreements}})(),Sequra=a.default})();